//
//  ProjectDataTool.m
//  laowu
//
//  Created by Northwan on 15/5/1.
//  Copyright (c) 2015年 长沙市岳麓区立早网络科技有限公司. All rights reserved.
//

#import "ProjectDataTool.h"

@implementation ProjectDataTool

+(void)getProjectInfoData:(NSInteger)maxId feature:(NSInteger)feature keywords:(NSString*)keywords success:(void (^)(ProjectInfoRes *))success failure:(void (^)(NSError *))failure{
    
    NSMutableDictionary *param =[NSMutableDictionary dictionary];
    [param setObject:APP_KEY_VALUE forKey:APP_KEY_KEY];
    [param setObject:[NSNumber numberWithInteger:maxId] forKey:@"max_id"];
    [param setObject:[NSNumber numberWithInteger:feature] forKey:@"feature"];
    if(!ISBLANK(keywords)){
        [param setObject:keywords forKey:@"name"];
    }
    [self postWithUrl:[NSString stringWithFormat:@"%@api/project/list.json",BASE_URL] param:param resultClass:[ProjectInfoRes class] success:success failure:failure];
}

+(void)getProjectSearchInfoData:(NSString *)key_word area:(NSString *)area job:(NSString *)job start:(NSString *)start end:(NSString*)end  maxId:(NSInteger)maxId success:(void (^)(ProjectListInfoRes *))success failure:(void (^)(NSError *))failure{
    
    NSMutableDictionary *param =[NSMutableDictionary dictionary];
    [param setObject:APP_KEY_VALUE forKey:APP_KEY_KEY];
    [param setObject:[NSNumber numberWithInteger:maxId] forKey:@"max_id"];
    [param setObject:key_word forKey:@"key_word"];
    [param setObject:area forKey:@"area"];
    [param setObject:job forKey:@"job"];
    [param setObject:start forKey:@"start"];
    [param setObject:end forKey:@"end"];
    [self postWithUrl:[NSString stringWithFormat:@"%@api/job_list.json",BASE_URL] param:param resultClass:[ProjectListInfoRes class] success:success failure:failure];
}

+(void)applyJob:(NSInteger)content_id success:(void (^)(BaseResponse *))success failure:(void (^)(NSError *))failure{
    NSMutableDictionary *param =[NSMutableDictionary dictionary];
    [param setObject:APP_KEY_VALUE forKey:APP_KEY_KEY];
    [param setObject:[NSNumber numberWithInteger:content_id] forKey:@"content_id"];
    NSInteger userId = [UserDefaultsHelper integerForKey:KEY_USER_ID];
    [param setObject:[NSNumber numberWithInteger:userId] forKey:@"user_id"];
    [self postWithUrl:[NSString stringWithFormat:@"%@api/jobapply.json",BASE_URL] param:param resultClass:[BaseResponse class] success:success failure:failure];
    
}

@end
